package com.sadhoc.router.pdu;

import java.io.Serializable;
import java.util.HashSet;

import com.sadhoc.router.topology.SequenceNumber;

public class TCMsg implements Serializable {

	private static final long serialVersionUID = -752088927028471529L;
	
	private String originator;
	private HashSet<String> nodes;
	private SequenceNumber sequenceNumber;
	private int hopcount;

	public TCMsg(String originator, SequenceNumber sequenceNumber, HashSet<String> nodes) {
		this.setOriginator(originator);
		this.sequenceNumber = sequenceNumber;
		this.nodes = nodes;
	}
	
	public boolean equals(TCMsg m) {
		if (this.originator.equals(m.getOriginator()))
			if (this.sequenceNumber.equals(m.getSequenceNumber()))
				return true;
		
		return false;
	}

	public HashSet<String> getNodes() {
		return nodes;
	}

	public void setNodes(HashSet<String> nodes) {
		this.nodes = nodes;
	}

	public SequenceNumber getSequenceNumber() {
		return sequenceNumber;
	}

	public void setSequenceNumber(SequenceNumber sequenceNumber) {
		this.sequenceNumber = sequenceNumber;
	}
	
	public void increaseHopCount() {
		hopcount++;
	}

	public int getHopcount() {
		return hopcount;
	}

	public void setHopcount(int hopcount) {
		this.hopcount = hopcount;
	}

	public String getOriginator() {
		return originator;
	}

	public void setOriginator(String originator) {
		this.originator = originator;
	}

}
